package com.example.blogsystem.mapper;

import com.example.blogsystem.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    // 注册
    @Insert("insert into blog_user(user_name, password) value (#{userName}, #{password})")
    Integer insertUser(@Param("userName") String userName, @Param("password") String password);

    // 登录：查询用户信息
    @Select("select * from blog_user where user_name = #{userName}")
    User checkUser(String userName);

    // 列表页：根据id查询用户信息
    @Select("select * from blog_user where id = #{id}")
    public User userById(Integer id);


}
